package net.wangds.auth.account.repo.rdbms;

import net.wangds.jpa.repository.RemovableRepo;
import net.wangds.auth.account.entity.GeneralAccountUserRef;
import net.wangds.data.DisableEnum;
import net.wangds.data.RemovedEnum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.BitSet;
import java.util.List;
import java.util.Optional;

@Repository
public interface AccountUserRefJpaRepo extends RemovableRepo<GeneralAccountUserRef> {

    List<GeneralAccountUserRef> findAllByAccountId(String accountId);


    Page<GeneralAccountUserRef> findByAccountId(String accountId, Pageable page);

    List<GeneralAccountUserRef> findAllByAccountIdAndDisable(String accountId, DisableEnum disable);

    List<GeneralAccountUserRef> findAllByAccountIdAndDisableAndRemoved(String accountId, DisableEnum disable, RemovedEnum removed);

    Page<GeneralAccountUserRef> findByAccountIdAndDisable(String accountId, DisableEnum disable, Pageable page);

    Optional<GeneralAccountUserRef> findByAccountIdAndUserId(String accountId, String userId);

    Optional<GeneralAccountUserRef> findByAccountIdAndUserIdAndDisable(String accountId, String userId, DisableEnum disable);

    boolean existsByAccountIdAndUserId(String accountId, String userId);

}
